//
//  SISSReceivedRequestCell.m
//  SISSAPP
//
//  Created by 优房网 on 2017/5/8.
//  Copyright © 2017年 优房网. All rights reserved.
//

#import "SISSReceivedRequestCell.h"
#import <SDWebImage/UIImageView+WebCache.h>

@interface SISSReceivedRequestCell ()

@property (weak, nonatomic) IBOutlet UIImageView *iconImageView;
@property (weak, nonatomic) IBOutlet UILabel *nameLabel;
@property (weak, nonatomic) IBOutlet UILabel *companyNameLabel;
@property (weak, nonatomic) IBOutlet UILabel *scoreLabel;
@property (weak, nonatomic) IBOutlet UIImageView *starLevelImageView;
@property (weak, nonatomic) IBOutlet UILabel *commentCountLabel;
@property (weak, nonatomic) IBOutlet UILabel *houseCountLabel;
@property (weak, nonatomic) IBOutlet UILabel *passengerCountLabel;

@end
@implementation SISSReceivedRequestCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}




- (void)setAgentInfoModel:(SISSAgentInfoModel *)agentInfoModel {
    _agentInfoModel = agentInfoModel;
    
    [self.iconImageView sd_setImageWithURL:[NSURL URLWithString:agentInfoModel.portrait] placeholderImage:[UIImage imageNamed:@"头像"]];
    self.nameLabel.text = agentInfoModel.name;
    self.companyNameLabel.text = agentInfoModel.organName;
    self.scoreLabel.text = [NSString stringWithFormat:@"%zd",agentInfoModel.score];
    self.starLevelImageView.image = [UIImage imageNamed:[NSString stringWithFormat:@"star_%zd",agentInfoModel.star_level]];
    self.commentCountLabel.text = [NSString stringWithFormat:@"共%zd人评价",agentInfoModel.comment_count];
    self.houseCountLabel.text = [NSString stringWithFormat:@"%zd",agentInfoModel.house_count];
    self.passengerCountLabel.text = [NSString stringWithFormat:@"%zd",agentInfoModel.demand_count];
}

/**
 同意按钮点击事件
 */
- (IBAction)agreeButtonClickAction:(id)sender {
    
    if ([self.delegate respondsToSelector:@selector(receivedRequestCell:didClickButtonAtIndex:)]) {
        [self.delegate receivedRequestCell:self didClickButtonAtIndex:2];
    }
}

/**
 不同意按钮点击事件
 */
- (IBAction)disagreeButtonClickAction:(id)sender {
    
    if ([self.delegate respondsToSelector:@selector(receivedRequestCell:didClickButtonAtIndex:)]) {
        [self.delegate receivedRequestCell:self didClickButtonAtIndex:1];
    }
}

/**
 咨询按钮点击事件
 */
- (IBAction)consultButtonClickAction:(id)sender {
    
    if ([self.delegate respondsToSelector:@selector(receivedRequestCell:didClickButtonAtIndex:)]) {
        [self.delegate receivedRequestCell:self didClickButtonAtIndex:0];
    }
}

@end
